package org.springframework.remoting.jsonrpc.test.contact;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

@Entity
public class Company {
  @Id
  @Column(name = "COMPANY_ID", nullable = false)
  @GeneratedValue(strategy = GenerationType.TABLE)
  long id;
  String name;
  
  @OneToMany(mappedBy="company",targetEntity=Contact.class,
      fetch=FetchType.EAGER)
      private Set contacts;
  
  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Set<Contact> getContacts() {
    return contacts;
  }

  public void setContacts(Set<Contact> contacts) {
    this.contacts = contacts;
  }

}
